//
//  ZBWelTableViewController.swift
//  ZBWb
//
//  Created by 天隐翎 on 16/4/8.
//  Copyright © 2016年 csdn. All rights reserved.
//

import UIKit

class ZBWelTableViewController: UITableViewController,ZBVisitorLoginDelegate {
//    设置用户是否登录的标记
    var userlogin = ZBuserInfoModelViewOuath.shareInfoModelViewOuath.userLogin
//    设置成属性.在子类用使用.来调用方法
    var v : ZBVisitorLogin?
    
    override func loadView() {
        userlogin ? super.loadView():prepareForVisitorLoginView()
    }
    
//    添加View
    func prepareForVisitorLoginView(){
        v = ZBVisitorLogin()
        
        v?.visitorDelegate = self
        
        view = v
//        设置导航条
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWilllogin")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegiser")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

//    代理方法执行
    func userWilllogin() {
//        print("登录")
//        点击登录后要执行的操作
        let auoth = AuothViewController()
//        添加到控制器中
        let nav = UINavigationController(rootViewController: auoth)
        
//        进行跳转
        presentViewController(nav, animated: true, completion: nil)
        
        
    }
    func userWillRegiser() {
//        print("注册")
    }

}
